package course.java.simulation;

import course.java.simulation.bankandexcute.Bank;
import course.java.simulation.bankandexcute.RequestObject;
import course.java.simulation.common.OperationType;

import java.util.HashMap;
import java.util.concurrent.LinkedBlockingQueue;

public class Main {
    public static void main(String[] args) {
        HashMap<String, Double>initUserIdAcctAmtMap = new HashMap<>();
        initUserIdAcctAmtMap.put("user1",500D);
        initUserIdAcctAmtMap.put("user2",600D);
        initUserIdAcctAmtMap.put("user3",700D);
        Bank bank =new Bank(initUserIdAcctAmtMap);
        LinkedBlockingQueue<RequestObject> objects = new LinkedBlockingQueue<>();
        RequestObject requestObject1 = new RequestObject("user1", OperationType.Pay,1D);
        RequestObject requestObject2= new RequestObject("user1", OperationType.Withdraw,2D);
        RequestObject requestObject3 = new RequestObject("user1", OperationType.Pay,3D);
        RequestObject requestObject4= new RequestObject("user1", OperationType.Withdraw,4D);
        objects.add(requestObject2);
        objects.add(requestObject1);
        objects.add(requestObject3);
        objects.add(requestObject4);
        bank.setBlockingQueue(objects);
        new Thread(bank).start();

    }


}
